<style>

.item-second
{
	background: url(../images/item.png) top left repeat-x;
	height: 25px;
	line-height: 25px;
	border: 1px solid silver;
	text-align: center;
}


.wraper .block_top {
    background: url("../images/bgh3.jpg") no-repeat scroll 5px 7px transparent;
    border-bottom: 1px solid #E1E1E1;
    clear: both;
    color: #333333;
    font-weight: bold;
    margin-bottom: 5px;
    overflow: hidden;
    padding: 5px 0 5px 25px;
}

.block_middle, .block_middle_no_pad {
    background: none repeat scroll 0 0 #FCFCFC;
    clear: both;
    font-size: 11px;
    line-height: 150%;
    margin-bottom: 15px;
    overflow: hidden;
    text-align: left;
    width: auto !important;
}

.block_middle_no_pad td {
    border: 1px solid #E1E1E1;
    padding: 5px;
}
.block_middle_left_top {
    background: none repeat scroll 0 0 #F3F3F3;
    border-bottom: 1px solid #E2E2E2;
    border-right: 1px solid #E2E2E2;
    padding-right: 8px;
    padding-top: 8px;
    vertical-align: top;
    width: 25%;
}
</style>			
			<div id="my_theme_options_content" style="width: 98%;">
                <!-- Tab choosen -->
                	<!-- 
		           <ul id="countrytabs_admin" class="shadetabs">       
		           	 	           
                        <li><a href="#" rel="mySetting_company_logo">Tải Logo</a></li>
                        <li><a href="#" rel="mySetting_area_location">Quản lý các danh mục tùy biến </a></li>
                        <li><a href="#" rel="mySetting_company_image_support">Đổi hình support sidebar</a></li>                   
                    </ul>
                    -->
                 <!-- End Tab choosen -->   
                    <div class="box-tabs">                    
                    
                     <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
                     
                     <?php 
                     ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                     function db_select_data_by_int($table,$key,$value)
                     {
                     	global $wpdb;
                     	$table = $wpdb->prefix.$table;
                     
                     	$query	= "SELECT * FROM $table
                     	WHERE $key=$value
                     	";
                     	$result	= $wpdb->get_results($query, OBJECT);
                     	if($result)
                     		return $result;
                     		else
                     			return false;
                     }
                     
                     function db_delete_item_price_by_id($id,$table)
					{
						global $wpdb;
						$table = $wpdb->prefix.$table;
						$query = "DELETE FROM $table WHERE ID=$id";
						$wpdb->query($query);
					}
					function db_select_all_data_where_char($table,$key,$value)
					{
							global $wpdb;
							$table = $wpdb->prefix.$table;
							$query	= "SELECT * FROM $table WHERE $key='".$value."' ORDER BY ID DESC";
							$result	= $wpdb->get_results($query, OBJECT);
							if($result)
								return $result;
							else 
								return false;	
					}
									
                     
                     $myurl = get_bloginfo('home')."/wp-admin/admin.php?page=my-dang-ky-contact-us";
                     if(isset($_GET['del']))
                     {
                     	$id = $_GET['del'];
                     	db_delete_item_price_by_id($id, "customers");
                     	wp_redirect($myurl);
                     }
                     
                     $customer = db_select_all_data_where_char("customers", "type", "contact");
                     
                     if(isset($_GET['view']) && $_GET['view'] != '')
                     {
                     	$customer = db_select_data_by_int("customers", "ID", $_GET['view']);
                     ?>
	                     <div class="wraper"><div class="block_top"><p class="align_right">
	                     <a href="<?php echo $myurl;?>">« Trở lại danh sách</a></p> 
	                     </div>
	                    <div class="block_middle_no_pad">
	                    <table width="90%" cellspacing="0" cellpadding="4">
	                      <tbody><tr>
	                        <td colspan="2" class="block_desc_top"><b>Thông tin cần thiết</b></td>
	                      </tr>
	                      <tr>	                    
	                        <td valign="top" align="right" class="block_middle_left_top"><b>ID</b></td>
	                        <td class="block_middle_right_top"><?php echo $customer[0]->ID;?>
	                        <a href="<?php bloginfo('home');?>/wp-admin/admin.php?page=my-dang-ky-contact-us&del=<?php echo $customer[0]->ID;?>">
	                        <img src="<?php bloginfo('template_url');?>/ws24options/images/del2.jpg"/>
	                        </a></td>
	                      </tr>
	                      <tr>
	                        <td valign="top" align="right" class="block_middle_left_top"><b>Người gửi</b>:</td>
	                        <td class="block_middle_right_top"><?php echo $customer[0]->customerName;?></td>
	                    
	                      </tr>
	                       <tr>
	                        <td valign="top" align="right" class="block_middle_left_top"><b>Điện thoại</b>:</td>
	                        <td class="block_middle_right_top"><?php echo $customer[0]->customerPhone;?></td>
	                      </tr>
	                       <tr>
	                        <td valign="top" align="right" class="block_middle_left_top"><b>Email</b>:</td>
	                        <td class="block_middle_right_top"><?php echo $customer[0]->customerEmail;?></td>
	                      </tr>                    
	                      <tr>
	                        <td valign="top" align="right" class="block_middle_left_top"><b>Nội dung</b>:</td>
	                         <td class="block_middle_right_top">
	                         	<?php echo $customer[0]->customerComment;?>
	                         </td>
	                      </tr> 
	                       
	                      <tr>
	                    
	                        <td colspan="2" class="block_desc_middle"><b>Thông tin thêm</b></td>
	                      </tr>
	                      <tr>
	                        <td valign="top" align="right" class="block_middle_left_top"><b>Thời gian gửi</b>:</td>
	                        <td class="block_middle_right_top"><?php echo $customer[0]->date;?></td>
	                      </tr>
	                    </tbody></table>
	                    
	                    </div>
	                    <div class="block_bottom"></div>	</div>
                     <?php 	
                     }
                     else 
                     {
                     ?>
                     
                     <div class="wraper">			
			            <h1 class="contactlist">Danh sách mail liên hệ</h1>
						<ul>
							<table class="contact-list">
								<tbody><tr class="contact_header">
									<td width="20%" class="name"><b>Name</b></td>									
			                        <td class="title"><b>Phone</b></td>
									<td width="23%" class="email"><b>Email</b></td>
									<td width="20%" class="time"><b>Time</b></td>
			                        <td width="5%" class="time"><b>Delete</b></td>
							  	</tr>								
									
								<?php 
								if($customer)
								{
									foreach ($customer as $value) 
									{
									?>
									<tr>
					                    <td><a href="<?php bloginfo('home');?>/wp-admin/admin.php?page=my-dang-ky-contact-us&view=<?php echo $value->ID;?>"><?php echo $value->customerName;?></a></td>					                    
					                    <td><?php echo $value->customerPhone;?></td>
					                    <td><?php echo $value->customerEmail;?></td>
					                    <td><?php echo $value->date;?></td>
					                    <td><a  href="<?php bloginfo('home');?>/wp-admin/admin.php?page=my-dang-ky-contact-us&del=<?php echo $value->ID;?>">
					                    	<img src="<?php bloginfo('template_url')?>/ws24options/images/del2.jpg"/>
					                    	</a>
					                    </td>
				                    </tr>									
									<?php 
									}
								}
								?>	
			                    	
			                    						
							</tbody></table>
						</ul>
			          </div>
                     <?php 
                     }
                     ?>
                     
                     <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->	                    
	           		 </div>
		             <script type="text/javascript">
						var countries=new ddtabcontent("countrytabs_admin")
						countries.setpersist(true)
						countries.setselectedClassTarget("link") 
						countries.init()
					</script>						             
    	</div>  